package com.tx.review.string_;

/**
 * 测试StringTable中的字符串也会被回收
 *  -Xmx10m -XX:+PrintStringTableStatistics -XX:+PrintGCDetails -verbose:gc
 * @author ：tx
 * @version:
 */
public class StringDeadDemo {


    public static void main(String[] args) {
        int i = 0;
        try {
            for (int j = 0; j < 1000000; j++) {
                String.valueOf(j).intern();
                i++;
            }
        } catch (Throwable e) {
            e.printStackTrace();
        } finally {
            System.out.println(i);
        }
    }
}
